<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core" 
      >
    <h:head>

        <h:outputScript name="calendar_ru.js" library="js"/>
    </h:head>
    <h:body>
        <h:form id="formform">

            <p:dataTable var="health" value="#{healthAnalysys.healthingAnalysysByPacientId()}" paginator="true" rows="10"  
                         rowKey="#{health.healingAnalyzesId}" id="tablej" selection="#{healthAnalysys.analyzess}" selectionMode="single" emptyMessage="Нет записей"> 
                <p:ajax event="rowSelect"  oncomplete="but.enable()"/>  
                <p:column  >  
                    <f:facet name="header">  
                        <h:outputText value="Название" />  
                    </f:facet>  
                    <h:outputText value="#{health.analyzesNameByAnalyzesNameId.name}"/>  
                </p:column>  
                <p:column  >  
                    <f:facet name="header">  
                        <h:outputText value="Время" />  
                    </f:facet>  
                    <h:outputText value="#{health.timestamp}"/>  
                </p:column>  
                <p:column  >  
                    <f:facet name="header">  
                        <h:outputText value="Значение" />  
                    </f:facet>  
                    <h:outputText value="#{health.value}"/>  
                </p:column>  

            </p:dataTable> 
            <p:commandButton disabled="true"   widgetVar="but" value="Добавить Значение" icon="ui-icon-plus" oncomplete="analyz.show()"/>

            <p:dialog  header="Добавить анализ" widgetVar="analyz" resizable="false"  
                      width="300" showEffect="explode" hideEffect="explode">
                <h:panelGrid id="display" columns="1" >
                    <h:outputText value="Название"/>
                    <p:inputText value="#{healthAnalysys.value}"/>
                    <p:commandButton  value="Сохранить" icon="ui-icon-disk" actionListener="#{healthAnalysys.save(healthAnalysys.analyzess.healingAnalyzesId,healthAnalysys.value)}" update="formform:tablej" oncomplete="analyz.hide()"/>
                </h:panelGrid>     
            </p:dialog>  
        </h:form>

    </h:body>
</html>

